<!DOCTYPE html>
<html>
<head>
    <include file="./public/sty.html"/>
</head>
<body onkeydown="keyLogin();">
<div id="app" class="login">
    <include file="./public/header.html"/>

    <div data-v-317c15dc="" class="container registerPage" s="[object Object]">
        <h3 data-v-317c15dc="" class="reg_tit"> 用户登录</h3>
        <p data-v-317c15dc="" class="reg_small"></p>
        <ul data-v-317c15dc="" class="submitContent mglr30 regMain">
            <form action="{:U('Users/securityCenter')}" method="get" id="form">
                <input type="hidden" name="hid" value="{$hid}">
                <li data-v-317c15dc="">
                    <span data-v-317c15dc="">账 号：</span>
                    <input data-v-317c15dc="" tag="帐号" type="text" id="uname" autocomplete="off" class="userInput"
                           onblur="cc()">
                    <em data-v-317c15dc="" class="verifyWrong" id="e1"></em>
                </li>
                <li data-v-317c15dc="">
                    <span data-v-317c15dc="">密 码：</span>
                    <input data-v-317c15dc="" tag="密码" id="pwd1" placeholder="密码应为6-16位字符" type="password"
                           autocomplete="off" class="userInput" onblur="cc()">
                    <em data-v-317c15dc="" class="verifyWrong" id="e2"></em>
                </li>

                <li data-v-317c15dc="" style="margin-top: 23px;">
                    <span data-v-317c15dc=""></span>
                    <a onclick="check()" data-v-317c15dc="" class="mainColorBtn submitBtnBig ClickShade">登录</a>
                    <a data-v-317c15dc="" href="{:U('Index/ResetPwd')}" class="forgetPwd">忘记密码?</a>
                </li>
            </form>
        </ul>
    </div>

    <include file="./public/footer.html"/>

    <div data-v-0835e1db="" class="layermbox layermbox2 layermshow" style="display: none;">
        <div data-v-0835e1db="" class="laymshade"></div>
        <div data-v-0835e1db="" class="layermmain">
            <div data-v-0835e1db="" class="section">
                <div data-v-0835e1db="" class="layermchild  layermanim">
                    <div data-v-0835e1db="" class="layermcont">
                        <i data-v-0835e1db=""></i>
                        <i data-v-0835e1db="" class="laymloadtwo"></i>
                        <i data-v-0835e1db=""></i>
                        <div data-v-0835e1db=""></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

<div id="tishi1" class="layermbox layermbox0 layermshow" index="11">
    <div class="laymshade"></div>
    <div class="layermmain">
        <div class="section">
            <div class="layermchild layerConfirm layermanim"><h3 style="">温馨提示</h3>
                <button class="layermend"></button>
                <div class="layermcont">·用户名不存在·</div>
                <div class="layermbtn"><span type="1">确定</span></div>
            </div>
        </div>
    </div>
</div>

<div id="tishi2" class="layermbox layermbox0 layermshow" index="11">
    <div class="laymshade"></div>
    <div class="layermmain">
        <div class="section">
            <div class="layermchild layerConfirm layermanim"><h3 style="">温馨提示</h3>
                <button class="layermend"></button>
                <div class="layermcont">·密码错误·</div>
                <div class="layermbtn"><span type="1">确定</span></div>
            </div>
        </div>
    </div>
</div>

<div id="tishi3" class="layermbox layermbox0 layermshow" index="11">
    <div class="laymshade"></div>
    <div class="layermmain">
        <div class="section">
            <div class="layermchild layerConfirm layermanim"><h3 style="">温馨提示</h3>
                <button class="layermend"></button>
                <div class="layermcont">·该用户已冻结·</div>
                <div class="layermbtn"><span type="1">确定</span></div>
            </div>
        </div>
    </div>
</div>


</html>
<script src="/style/js/jquery.min.js"></script>
<script src="/style/js/fx.js"></script>
<script>
    var uul = "<?php echo $_SESSION['url1'];?>";

    function keyLogin() {
        if (event.keyCode == 13)   //回车键的键值为13
            check();  //调用登录按钮的登录事件
    }
    function cc() {
        uname = $("#uname").val().replace(/(^\s+)|(\s+$)/g, "");
        pawd = $("#pwd1").val().replace(/(^\s+)|(\s+$)/g, "");
        if (uname == "") {
            $("#e1").html('<i data-v-317c15dc=""></i>帐号不能为空');
        } else {
            $("#e1").html('');
        }
        if (pawd == "") {
            $("#e2").html('<i data-v-317c15dc=""></i>密码不能为空');
        } else {
            $("#e2").html('');
        }
    }
    function check() {
        uname = $("#uname").val().replace(/(^\s+)|(\s+$)/g, "");
        pawd = $("#pwd1").val();
        if (uname == "") {
            $("#e1").html('<i data-v-317c15dc=""></i>帐号不能为空');
            return false;
        } else {
            $("#e1").html('');
        }
        if (pawd == "") {
            $("#e2").html('<i data-v-317c15dc=""></i>密码不能为空');
            return false;
        } else {
            $("#e2").html('');
        }
        if (pawd.length < 6 || pawd.length > 16) {
            $("#e2").html('<i data-v-317c15dc=""></i>密码应为6-16位字符');
            return false;
        }
        $.ajax({
            type: "POST",
            url: "{:U('Index/dologin')}",
            data: {username: uname, pwd: pawd},
            dataType: "json",
            success: function (data) {
                if (data == 1) {
                   $("#tishi1").show();
                    return false;
                } else if (data == 2) {
                    $("#tishi2").show();
                    return false;
                } else if (data == 4) {
                    $("#tishi3").show();
                    return false;
                } else {
                    if (uul == "") {
                        $("#form").submit();
                    } else {
                        window.location.href = uul;
                    }
                }
            }
        });
    }
</script>
